/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.portlet.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;

import com.portlet.model.quycachSP;
import com.portlet.model.quycachSPModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the quycachSP service. Represents a row in the &quot;congty_quycachSP&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.portlet.model.quycachSPModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link quycachSPImpl}.
 * </p>
 *
 * @author Thi
 * @see quycachSPImpl
 * @see com.portlet.model.quycachSP
 * @see com.portlet.model.quycachSPModel
 * @generated
 */
public class quycachSPModelImpl extends BaseModelImpl<quycachSP>
	implements quycachSPModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a quycach s p model instance should use the {@link com.portlet.model.quycachSP} interface instead.
	 */
	public static final String TABLE_NAME = "congty_quycachSP";
	public static final Object[][] TABLE_COLUMNS = {
			{ "maQC", Types.VARCHAR },
			{ "tenQC", Types.VARCHAR }
		};
	public static final String TABLE_SQL_CREATE = "create table congty_quycachSP (maQC VARCHAR(75) not null primary key,tenQC VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table congty_quycachSP";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.portlet.model.quycachSP"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.portlet.model.quycachSP"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = false;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.portlet.model.quycachSP"));

	public quycachSPModelImpl() {
	}

	public String getPrimaryKey() {
		return _maQC;
	}

	public void setPrimaryKey(String primaryKey) {
		setMaQC(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return _maQC;
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey((String)primaryKeyObj);
	}

	public Class<?> getModelClass() {
		return quycachSP.class;
	}

	public String getModelClassName() {
		return quycachSP.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("maQC", getMaQC());
		attributes.put("tenQC", getTenQC());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		String maQC = (String)attributes.get("maQC");

		if (maQC != null) {
			setMaQC(maQC);
		}

		String tenQC = (String)attributes.get("tenQC");

		if (tenQC != null) {
			setTenQC(tenQC);
		}
	}

	public String getMaQC() {
		if (_maQC == null) {
			return StringPool.BLANK;
		}
		else {
			return _maQC;
		}
	}

	public void setMaQC(String maQC) {
		_maQC = maQC;
	}

	public String getTenQC() {
		if (_tenQC == null) {
			return StringPool.BLANK;
		}
		else {
			return _tenQC;
		}
	}

	public void setTenQC(String tenQC) {
		_tenQC = tenQC;
	}

	@Override
	public quycachSP toEscapedModel() {
		if (_escapedModel == null) {
			_escapedModel = (quycachSP)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
		}

		return _escapedModel;
	}

	public quycachSP toUnescapedModel() {
		return (quycachSP)this;
	}

	@Override
	public Object clone() {
		quycachSPImpl quycachSPImpl = new quycachSPImpl();

		quycachSPImpl.setMaQC(getMaQC());
		quycachSPImpl.setTenQC(getTenQC());

		quycachSPImpl.resetOriginalValues();

		return quycachSPImpl;
	}

	public int compareTo(quycachSP quycachSP) {
		String primaryKey = quycachSP.getPrimaryKey();

		return getPrimaryKey().compareTo(primaryKey);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof quycachSP)) {
			return false;
		}

		quycachSP quycachSP = (quycachSP)obj;

		String primaryKey = quycachSP.getPrimaryKey();

		if (getPrimaryKey().equals(primaryKey)) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return getPrimaryKey().hashCode();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<quycachSP> toCacheModel() {
		quycachSPCacheModel quycachSPCacheModel = new quycachSPCacheModel();

		quycachSPCacheModel.maQC = getMaQC();

		String maQC = quycachSPCacheModel.maQC;

		if ((maQC != null) && (maQC.length() == 0)) {
			quycachSPCacheModel.maQC = null;
		}

		quycachSPCacheModel.tenQC = getTenQC();

		String tenQC = quycachSPCacheModel.tenQC;

		if ((tenQC != null) && (tenQC.length() == 0)) {
			quycachSPCacheModel.tenQC = null;
		}

		return quycachSPCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(5);

		sb.append("{maQC=");
		sb.append(getMaQC());
		sb.append(", tenQC=");
		sb.append(getTenQC());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(10);

		sb.append("<model><model-name>");
		sb.append("com.portlet.model.quycachSP");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>maQC</column-name><column-value><![CDATA[");
		sb.append(getMaQC());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>tenQC</column-name><column-value><![CDATA[");
		sb.append(getTenQC());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = quycachSP.class.getClassLoader();
	private static Class<?>[] _escapedModelInterfaces = new Class[] {
			quycachSP.class
		};
	private String _maQC;
	private String _tenQC;
	private quycachSP _escapedModel;
}